package com.dk.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

/**
 * @author Create by whg
 * @ModuleName Swagger2Config
 * @Description: 描述信息
 * @date Created on 2021/10/21 18:08
 */
@Configuration
public class Swagger2Config {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.dk.controller"))
                .paths(PathSelectors.any())
                .build();
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("智能推荐微服务接口")  // 大标题
                .description("智能推荐管理接口,这个接口有一些关于智能推荐的车.....") //描述
                .termsOfServiceUrl("www.dddd.com")  //网络服务地址
                .version("1.1.2")     //版本号
                .build();
    }
}
